<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app"></div>
  <!-- 1.引入依赖 -->
  <script src="../react/react.development.js"></script>
  <script src="../react/react-dom.development.js"></script>
  <script src="../react/babel.min.js"></script>
  <!-- 2.开始开发 -->
  <script type="text/babel">
    class App extends React.Component{
      constructor() {
        super()
        
        this.state = {
         firstName: 'wu',
         lastName: 'yifan',
         isLogin: true
        }
      }

      render() {
        // 对象解构
        const {firstName, lastName} = this.state

        return (
          <div>
            {/* 1.运算符表达式 */}
            <div>{firstName + ' ' + lastName}</div>
            <div>{100 * 50}</div>

            {/* 2.三元运算符 */}
            <div>{this.state.isLogin && '登录成功'}</div>

            {/* 3.函数调用 */}
            <div>{this.fullName()}</div>
          </div>
        )
      }

     fullName() {
        return this.state.firstName + this.state.lastName
      }

    }
    ReactDOM.render(<App/>, document.getElementById('app'))
  </script>
</body>

</html>